package com.mars.pay.common;

import lombok.Getter;

/**
 * 支付方式枚举
 *
 * @author Mars
 */
@Getter
public enum PaymentTypeEnum {

    /**
     * 微信支付
     */
    WECHAT("WECHAT", "微信支付"),

    /**
     * 支付宝支付
     */
    ALIPAY("ALIPAY", "支付宝支付");

    private final String code;
    private final String desc;

    PaymentTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据 code 获取枚举
     */
    public static PaymentTypeEnum getByCode(String code) {
        for (PaymentTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}

